package com.company.section3;

public class TestMutlti {
    public static void main(String[] args) {
        new TestMutlti().test();
    }
    public void test(){
        Userful[] x={
                new Userful(),
                new MoreUserful()
        };
        x[0].f();
        x[1].g();
        ((MoreUserful)x[1]).u();
       // ((MoreUserful)x[0]).u();//Exception throw
        ((MoreUserful)x[0]).f();//Exception throw
    }
    class Userful{
        public void f(){System.out.println("Userful f");};
        public void g(){System.out.println("Userful g");};
    }
    class MoreUserful extends Userful{
        public void f(){System.out.println("MoreUserful f");};
        public void g(){System.out.println("MoreUserful g");};
        public void u(){};
        public void v(){};
        public void w(){};
    }
}
